/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import javax.swing.table.AbstractTableModel;

import com.ruipengkj.bean.TBehavior;
/**
 * 说明：
 * 商品详细公共model
 * @Author：李智深
 * @Date：2012-03-16
 */
public class BehaviorDetailModel extends AbstractTableModel {

	private static final long serialVersionUID = 1L;
	private List<TBehavior> behaviors = new ArrayList();
	private Vector<String> columns = new Vector<String>();
	
	public BehaviorDetailModel(){
		columns.add("时间");
		columns.add("用户");
		columns.add("行为类型");
	}
	
	//获得行数
	@Override
	public int getRowCount(){
		return behaviors.size();
	}
	
	//获得列数
	@Override
	public int getColumnCount(){
		return columns.size();
	}
	//获取列名
	@Override
	public String getColumnName(int column){
		return (String)columns.get(column);
	}
	//设置单元格是否可编辑
	@Override
	public boolean isCellEditable(int rowIndex,int columnIndex){
		return false;
	}
//	//获取列对应的类型
//	public Class getColumnClass(int column){
//		return Object.class;
//	}
	//获得单元格的值
	@Override
	public Object getValueAt(int row,int column){
		TBehavior behavior = behaviors.get(row);
		if(behavior!=null){
			switch (column) {
				case 0:
					return behavior.getBHappenTime();
				case 1:
					return behavior.getBUserID();
				case 2:
					return behavior.getBTypeName();
			}
		}
		return null;
	}
	
	
	public void setBehaviorList(List<TBehavior> _behaviors){
		this.behaviors=_behaviors;
	}
}
